home *** CD-ROM | disk | FTP | other *** search
- /* functions to open files as needed in qndxr work...
- */
-
- #include <stdio.h>
- #include <unix.h>
- #include <storage.h>
- #include <strings.h>
- #include <ctype.h>
- #include <proto.h>
- #include "qndxr.2.h"
-
- FILE *open_docfile (argc, argv)
- int argc;
- char *argv[];
- {
- FILE *fp, *fopen();
- void exit();
-
- if (argc < 2)
- {
- printf ("\nToo few command line arguments!\n");
- printf ("\nEnter a text file name (no embedded spaces allowed)\n");
- printf ("and the program will build and sort a complete inverted\n");
- printf ("index to that file. Use \">\" in front of a file name to\n");
- printf ("redirect console output (UNIX-fashion) if desired.\n");
- printf ("Give the program a value for available memory (in bytes)\n");
- printf ("if the default value of 512kB is unsatisfactory ... larger\n");
- printf ("memory allows for faster index building and sorting.\n");
- printf ("Other command-line arguments:\n");
- printf (" \"-e\" preserves embedded punctuation\n");
- printf (" \"-a\" preserves all punctuation characters\n");
- printf (" \"-s\" preserves special (non-ASCII) characters\n");
- printf ("\nContact Mark Zimmermann, 9511 Gwyndale Drive, Silver Spring\n");
- printf ("Maryland 20910 USA; 301-565-2166; science (at) nems.arpa;\n");
- printf ("[75066,2044] on CompuServe for further information. - ^z\n");
- exit (1);
- }
-
- if ((fp = fopen (argv[1], "r")) == NULL)
- {
- printf ("\nFatal error opening document file\"%s\"!\n", argv[1]);
- exit (1);
- }
-
- return (fp);
- }
-
-
- /* open the key file with proper name for this pass ... file will be
- * named "x0kN" where N represents the pass number ....
- */
-
- FILE *open_kfile (pass_number)
- int pass_number;
- {
- FILE *fopen();
- char fname[32];
-
- sprintf (fname, "x0k%d", pass_number);
- return (fopen (fname, "wb"));
- }
-
-
- /* open the ptr file with proper name for this pass ... file will be
- * named "x0pN" where N represents the pass number ....
- */
-
- FILE *open_pfile (pass_number)
- int pass_number;
- {
- FILE *fopen();
- char fname[32];
-
- sprintf (fname, "x0p%d", pass_number);
- return (fopen (fname, "wb"));
- }
-
-
-